1
2
3
4 package joeq.ClassLib.Common.java.lang;
5
6 import java.io.InputStream;
7 import java.io.PrintStream;
8 import joeq.Class.PrimordialClassLoader;
9 import joeq.Class.jq_Class;
10 import joeq.Class.jq_CompiledCode;
11 import joeq.Class.jq_StaticField;
12 import joeq.Memory.StackAddress;
13 import joeq.Runtime.ArrayCopy;
14 import joeq.Runtime.HashCode;
15 import joeq.Runtime.Reflection;
16 import joeq.Runtime.StackCodeWalker;
17 import joeq.Runtime.SystemInterface;
18
19 /***
20 * System
21 *
22 * @author John Whaley <jwhaley@alum.mit.edu>
23 * @version $Id: System.java 1941 2004-09-30 03:37:06Z joewhaley $
24 */
25 public abstract class System {
26
27 private static void registerNatives() { }
28 private static void setIn0(InputStream in) {
29 Reflection.putstatic_A(_in, in);
30 }
31 private static void setOut0(PrintStream out) {
32 Reflection.putstatic_A(_out, out);
33 }
34 private static void setErr0(PrintStream err) {
35 Reflection.putstatic_A(_err, err);
36 }
37 public static long currentTimeMillis() {
38 return SystemInterface.currentTimeMillis();
39 }
40 public static void arraycopy(java.lang.Object src, int src_position,
41 java.lang.Object dst, int dst_position,
42 int length) {
43 ArrayCopy.arraycopy(src, src_position, dst, dst_position, length);
44 }
45 public static int identityHashCode(java.lang.Object x) {
46 return HashCode.identityHashCode(x);
47 }
48 public static native void initializeSystemClass();
49 static java.lang.Class getCallerClass() {
50 StackCodeWalker sw = new StackCodeWalker(null, StackAddress.getBasePointer());
51 sw.gotoNext(); sw.gotoNext(); sw.gotoNext();
52 jq_CompiledCode cc = sw.getCode();
53 if (cc == null) return null;
54 return Reflection.getJDKType(cc.getMethod().getDeclaringClass());
55 }
56 public static final jq_Class _class = (jq_Class)PrimordialClassLoader.loader.getOrCreateBSType("Ljava/lang/System;");
57 public static final jq_StaticField _in = _class.getOrCreateStaticField("in", "Ljava/io/InputStream;");
58 public static final jq_StaticField _out = _class.getOrCreateStaticField("out", "Ljava/io/PrintStream;");
59 public static final jq_StaticField _err = _class.getOrCreateStaticField("err", "Ljava/io/PrintStream;");
60
61
62
63 }